Recently, with the development of a multimedia technology, an electronic device having various functions is emerging. For example, an electronic device, such as a smartphone which has recently been released, provides various functions that support input and/or output of an audio signal (e.g., a call function, a music file playback function, a high-quality video playback function).
In general, in order to support the input and/or output of an audio signal, an electronic device detects whether an earphone is inserted into an ear jack (i.e., a headphone jack) of the electronic device, and when the earphone insertion is detected, the electronic device performs an input and/or output function of the audio signal.
However, in place of an earphone, a foreign substance may flow into the ear jack of the electronic device, and the electronic device may recognize the foreign substance as the insertion of the earphone. When the electronic device recognizes the foreign substance flowing into the ear jack as the earphone insertion, the electronic device malfunctions, and this will eventually result in an inconvenience to a user.